home *** CD-ROM | disk | FTP | other *** search
-
- MYVCS - Pete Cervasio's Non-Version Control System. Version 1.0
-
- A really stupid example of how to interface with the Version Control Manager
- in Borland's Delphi.
-
- Copyright 1995, Peter W. Cervasio
- All Rights Undeserved.
-
- This is really stupid, but it shows how to use the VCSINTF and TOOLINTF
- units. I don't really have any plans on expanding this into a real version
- control system. Maybe someone out there will do it. If you do, please
- remember where you learned this, and send me a registered copy of it. I
- could really use one. <grin>
-
- How did I figure this out?? Well, I looked at the demo source code for the
- App/Dialog Expert. That showed me a lot about how the TOOLINTF unit was
- used. I then slowly but surely added more and more functions into this
- little DLL until it looked like it showed enough.
-
- This code is released as freely available software. You may do anything you
- wish to with it, including making the the worlds greatest version control
- system and selling it for a lot of money. I don't care, I just wanted to
- figure out what I could about the VCS Manager. The only thing you can't do
- is pretend that you wrote this. Ugh... who would want to admit that,
- anyway? I don't even want to, but my user-id is going to be on the upload
- description, so I might as well admit it. <big grin>
-
- One exception to the preceeding paragraph: Borland International is granted
- any rights to this code that they want. I especially hope that that they
- will take this code, do whatever cleanup they feel needs done, and include
- it in the next release of Delphi so people will understand what's going on
- with the VCSINTF unit a bit.
-
- The real work goes on in MYVCS.PAS. The code that starts the conversation
- between Delphi and MyVCS is in the function MyVCSInit. Here it is:
-
- function MyVCSInit (VCSInterface: TIToolServices): TIVCSClient; export;
- begin
- ToolInterface := VCSInterface;
- if ToolInterface <> nil then
- begin
- MyVCSClient := TMyVCSClient.Create;
- WindowHandle := VCSInterface.GetParentHandle;
- result := MyVCSClient;
- end
- else
- result := nil;
- end;
-
- I've declared ToolInterface as a global TIToolServices, and MyVCSClient as a
- global TMyVCSClient. If I receive a valid VCSInterface from Delphi, I
- assign it to ToolInterface, and create a TMyVCSClient to pass back. If not,
- I return nil. When things weren't working so well (the first couple of
- tries), I would get a "Could not open communication with the VCS Manager"
- type of message from Delphi, but everything else kept working so I guess
- this is the right thing to do.
-
- All the rest of the work happens in the TMyVCSClient class. As a menu title
- to add to the Delphi menubar, I'm returning "&Workgroup". This is what the
- PVCS interface uses, so I guess it's a pretty good 'standard' to use. The
- number of menu items is returned by the GetVerbCount method, and the text of
- those items is returned by the GetVerb(Index) method. The state of the menu
- items is set with GetVerbState(Index). Since this is a really stupid
- example, I'm just returning vsEnabled for any menu item. In a *real* VCS
- manager, you would enable and disable options as the project state changes.
-
- When the user picks one of those menu items, the ExecuteVerb method is
- called with the index of the menu item selected. This is fairly straight-
- forward. The ToolServices object we were passed on initialization allows us
- to open files, close files, get a list of units and forms, and all kinds of
- things. The only things this DLL does: open a file, close the current
- project or file (which might be a form or a unit), show a list of units and
- forms in the project, and two goofy little dialog boxes that show the number
- of files and units. These last two are leftovers from the very first
- incarnation of the DLL. Oh, there's an about box, too.
-
- I hope this helps people understand how the VCS Interface unit works, and
- how you would go about sticking a version control system into Delphi. Again,
- it's a really stupid example, but it works. :-)
-
- If you want to contact me about this code, I can be reached either in the
- Delphi forum on Compuserve, or via Fidonet netmail. I can't promise to
- answer your questions, but I'll try.
-
- Peter Cervasio
- Compuserve: 73443,1426 Fidonet: 1:130/209
-
-